﻿using MRGSP.SurveyMaster.Core.Model;
using MRGSP.SurveyMaster.Data;
using NUnit.Framework;

namespace MRGSP.SurveyMaster.Tests.Data
{
    public class SurveySessionRepositoryTests : BaseRepoTest
    {
        readonly SurveySessionRepository repo = new SurveySessionRepository(new ConnectionFactory());
        readonly SurveyRepository surveyRepository = new SurveyRepository(new ConnectionFactory());
        readonly Repo<User> userRepository = new Repo<User>(new ConnectionFactory());
        readonly QuestionRepository questionRepository = new QuestionRepository(new ConnectionFactory());

        [Test]
        public void DoneTest()
        {
            var user = userRepository.Insert(new User { Login = "us1", Password = "pa1", Role = 2 });
            var s1 = surveyRepository.Insert(new Survey { Name = "su1" });
            var q = questionRepository.Insert(null, "qu1", 1, s1, false);
            repo.Insert(s1, user, new[] { new Answer { QuestionId = q } });
            repo.Done(s1);
        }

    }
}